package com.bestbuy.pojo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * @author ThanhNgo
 * 
 */
@Entity
@Table(name = "cart")
public class Cart {
	@Id
	@Column(name = "IDCART")
	@GeneratedValue
	private Integer idcart;

	@ManyToOne
	@JoinColumn(name = "IDACCOUNT")
	@Fetch(FetchMode.JOIN)
	private Account account;

	@Column(name = "ISDELETED")
	private Integer isdeleted;

	@Column(name = "TOTAL")
	private Float total;

	@OneToMany(mappedBy = "cart", fetch = FetchType.LAZY)
	private Set<CartDetail> cartDetails = new HashSet<CartDetail>(0);

	@OneToMany(mappedBy = "cart", fetch = FetchType.LAZY)
	private Set<Bill> bills = new HashSet<Bill>(0);

	public Integer getIdcart() {
		return idcart;
	}

	public void setIdcart(Integer idcart) {
		this.idcart = idcart;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public Integer getIsdeleted() {
		return isdeleted;
	}

	public void setIsdeleted(Integer isdeleted) {
		this.isdeleted = isdeleted;
	}

	public Float getTotal() {
		return total;
	}

	public void setTotal(Float total) {
		this.total = total;
	}

	public Set<CartDetail> getCartDetails() {
		return cartDetails;
	}

	public void setCartDetails(Set<CartDetail> cartDetails) {
		this.cartDetails = cartDetails;
	}

	public Set<Bill> getBills() {
		return bills;
	}

	public void setBills(Set<Bill> bills) {
		this.bills = bills;
	}

	public Cart(Integer idcart, Account account, Integer isdeleted,
			Float total, Set<CartDetail> cartDetails, Set<Bill> bills) {
		super();
		this.idcart = idcart;
		this.account = account;
		this.isdeleted = isdeleted;
		this.total = total;
		this.cartDetails = cartDetails;
		this.bills = bills;
	}

	public Cart() {
		super();
		// TODO Auto-generated constructor stub
	}

	
}
